package com.xyh;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

public class Send {
    public static void main(String[] args) throws  Exception{
        ConnectionFactory factory=new ConnectionFactory();
        factory.setHost("localhost");
        Connection connection=factory.newConnection();
        Channel channel=connection.createChannel();
        String queueName="hello";
        channel.queueDeclare(queueName,false,false,false,null);
        String message="Hello World22!";
        channel.basicPublish("",queueName,null,message.getBytes());
        channel.close();
        connection.close();
    }
}
